How VirtualDub's filter system works |
VirtualDub's filtering system is a linear one; that is, no parallel or feedback paths are involved, and each filter has exactly one input and one output. This simplifies filter design considerably, while retaining much of the power of a full-fledged filter graph system. When filtering is enabled, implicit input and output filters convert to and from uncompressed RGB32 video. All filters in between work in RGB32, and although the bulky buffer size is a performance penalty, it dissolves all sorts of nasty alignment and bit/byte packing problems that go with 16- and 24-bit video. In addition, regardless of the number of filters involved, there is always one input buffer, one output buffer, and up to two ping-pong buffers. With long chains, VirtualDub will ping-pong the output of filters back and forth across the two temporary buffers, using the same amount of frame buffer memory regardless of the chain length.
When initiating a dub operation, VirtualDub runs the filter chain through a number of stages:
Each filter instance is queried in sequence to determine the given output buffer for each input buffer. VirtualDub notes the buffer requirements for each filter and determines the size of ping-pong buffers and the output buffer, as well as if a last-input buffer is needed.
Buffer layout is more flexible than standard Windows DIBs. Like DirectX surfaces, VFBitmaps can have a pitch wider than scanlines in the image for alignment purposes.
Each filter allocates and initializes any private work buffers, lookup tables, and dynamic code segments necessary for the upcoming operation.
Filters are called sequentially for each frame. This is the time-critical section, especially if a preview is running.
Filters deallocate private buffers, tables, and dynamic code segments.
Preview mode in VirtualDub uses the normal dubbing code, with a special audio and video rendering backend. There is no difference in filtering.
VirtualDub external filter SDK 1.05 | ©1999-2001 Avery Lee <phaeron@virtualdub.org> |